Conventionally, in a system or the like for transmitting a bit stream of moving images or recording the bit stream on a recording medium, high-efficiency encoding is performed to efficiently use a transmission path or recording capacity. In an image encoding device for realizing the high-efficiency encoding, the encoding bit rate of a bit stream generated by an encoder is set to a certain rate according to the transfer rate of a transmission medium. Under this restriction, the quantity of data to be generated, i.e., the quantization step of quantization in the encoder, is controlled. That is, the image encoding device increases the quantization step to suppress the quantity of data to be generated when images having a complicated picture pattern continue, for example, whereas decreases the quantization step to increase the quantity of data to be generated when images having a simple picture pattern continue, thereby maintaining a fixed rate to prevent overflow or underflow of a buffer memory.
Therefore, in the image encoding device according to such a related art, the quantization step increases to degrade image quality when complicated images continue, whereas the quantization step decreases when simple images continue, so that uniform image quality cannot be obtained as a whole. In view of this problem, for example, Patent Document 1 discloses an image encoding device that calculates an assigned code quantity to be assigned to each GOP (Group Of Pictures) itself in accordance with the ratio between difficulty in encoding of each GOP and the total sum of difficulties in encoding of a plurality of GOPs so that a large quantity is assigned to a GOP including an image having a complicated picture pattern and that a small quantity is assigned to a GOP including an image having a simple picture pattern.
On the other hand, as a method for adjusting a generated code quantity to a target code quantity given to one picture, step 2 of TM5 (test model 5) is well known, for example. In this method, a code quantity assigned to a picture is evenly distributed to macro blocks (MBs), each distributed quantity being set as a target code quantity of each MB, and adjustment to the target code quantity is performed through feedback control in the picture.
Also, in an encoding process based on a redundant compression method such as MPEG (Moving Picture Experts Group), an image encoding device performs orthogonal transformation such as DCT (Discrete Cosine Transform) and then performs a quantization process, thereby performing a process of reducing the quantity of information. Then, the image encoding device controls the value of the quantization to control a code quantity. At this time, a monotonous reduction relationship is established between a quantization parameter and a generated code quantity. Therefore, the image encoding device can predict a generated code quantity by actually calculating code quantities using quantization values of appropriate intervals and performing linear interpolation on a predictive value of the code quantity positioned at the middle (binary search or the like performed by intra-VTR such as DV).
This method can be applied to not only an encoding method using a fixed table, such as MPEG2, but also a context adaptive encoding method used in AVC (Advanced Video Coding) or the like.    Patent Document 1: Japanese Patent No. 3358620
However, in the above-described method of step 2 of TM5, degradation of image quality may occur in encoding of picture at the top of a sequence or a picture just after change of a scene because the initial value of the quantization step does not conform to the pattern of the picture.
For example, in the method of step 2 of TM5, in the image encoding device, in a case where the quantization step in a portion before feedback follows the picture pattern is too large, the image quality of the portion is degraded compared to the other portion. In a case where the quantization value is too small, too much code quantity is used in the portion and the influence thereof may be exerted on the other portion.
Also, in the image encoding device, the target code quantity of an MB is always kept constant, and thus inappropriate distribution of code quantity occurs when difficulty of an image is uneven in a screen.
On the other hand, in the above-described process of predicting a generated code quantity, the image encoding device needs to have many quantization processing units and code length calculating units in parallel in order to perform precise prediction and reduce errors due to interpolation. In this case, the image encoding device improves the precision for predicting a code quantity by having many circuits in parallel. However, the hardware scale thereof is large, and it is desired to reduce the circuit scale.
Accordingly, the present invention is directed to reducing a circuit scale in predicting a code quantity.